package com.test;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;


@RestController("/")
@SpringBootApplication
public class App {

    public static void main(String[] args) {
        try {
            ApplicationContext ac = SpringApplication.run(App.class);
            System.out.println("服务器端口: " + ac.getBean(ServerPortUtil.class).getPort());
//            while (true) {
//                System.out.println(LocalDateTime.now().toString());
//            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    @RequestMapping("hello")
    public String hello(){
        return "hello " + LocalDateTime.now().toString();
    }

}
